import {$request} from '../utils/request'

// 获取首页布局数据

export const getHomeList = (params = {}) => {
    params.url = "/page/detail"
    params.method = "GET"
    return $request(params)
}
//商品详情
export const getdetailList = (params = {}) => {
  params.url = "/goods/detail"
  params.method = "GET"
  return $request(params)
}
// 商品服务
export const getService = (params = {}) => {
  return get('/goods.service/list', params)
}
export const getCategoryList = (params = {}) => {
  params.url = "/category/list"
  params.method = "GET"
  return $request(params)
}
export const getGoodsList = (params = {}) => {
  params.url = "/goods/list"
  params.method = "GET"
  return $request(params)
}

export const getorderList = (params = {}) => {
  params.url = "/order/list"
  params.method = "GET"
  return $request(params)
}

export const getaddId = (params = {}) => {
  params.url = "/cart/add"
  params.method = "post"
  return $request(params)
}

// 定义快速登录的接口
export const quickLogin = (params = {})=>{
  params.url = "/passport/loginMpWx"
  params.method = "POST"
  return $request(params)
}
// 定义用户注册登录的接口
export const loginMpWxMobile = (params = {})=>{
  params.url = "/passport/login"
  params.method = "POST"
  return $request(params)
}

export const getUserInfo = (params = {})=>{
  params.url = "/user/info"
  params.method = "get"
  return $request(params)
}

export const getUserAssets = (params = {})=>{
  params.url = "/user/assets"
  params.method = "get"
  return $request(params)
}
//加入购物车
export const addCart = (params = {})=>{
  params.url = "/cart/add"
  params.method = "POST"
  return $request(params)
}

// 获取收货地址列表
export const getAddressList = (params = {})=>{
  params.url = "/address/list"
  params.method = "GET"
  return $request(params)
}
// 获取 省市区列表 /region/tree
export const getRegionTree = (params = {})=>{
  params.url = "/region/tree"
  params.method = "GET"
  return $request(params)
}
// 新增省市区 /address/add
export const addAddress = (params = {})=>{
  params.url = "/address/add"
  params.method = "POST"
  return $request(params)
}
// 获取默认地址 /address/defaultId

export const getDetaulAddresId = (params = {})=>{
  params.url = "/address/defaultId"
  params.method = "GET"
  return $request(params)
}
// 设置默认地址 /address/setDefault
export const setDefaultAddress = (params = {})=>{
  params.url = "/address/setDefault"
  params.method = "POST"
  return $request(params)
}

// 删除地址 /address/remove
export const removeAddress = (params = {})=>{
  params.url = "/address/remove"
  params.method = "POST"
  return $request(params)
}
//购物车列表
export const getCartList = (params = {})=>{
  params.url = "/cart/list"
  params.method = "GET"
  return $request(params)
}
//提交结算
export const dingdanSubmit = (params = {})=>{
  params.url = "/checkout/submit"
  params.method = "POST"
  return $request(params)
}
// /checkout/order
export const checkoutOrder = (params = {})=>{
  params.url = "/checkout/order"
  params.method = "GET"
  return $request(params)
}
